from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash
from contextlib import closing
from manager import app
import re
# import RPi.GPIO as GPIO
@app.route('/')
def show_index():
  return render_template('home.html')

@app.route('/jhome/<int:switch>',methods=['POST'])
def feeder(switch):
  if request.method == 'POST':
    # GPIO.setmode(GPIO.BOARD)
    if (switch == 1):
      # GPIO.setup(id,GPIO.OUT)
      # GPIO.setmode(GPIO.BOARD)
      # GPIO.setup(id,GPIO.OUT)
      # GPIO.output(id,False)
      print("Feeder ON ")
    else:
      # GPIO.setup(id-100,GPIO.OUT)
      # GPIO.output(id-100,True)
      print("Feeder OFF")
  return redirect(url_for('show_index'))

